package com.lebang.service;

import com.lebang.domain.RouseMoneyFilterConfig;
import com.lebang.example.RouseMoneyFilterConfigExample;
import com.lebang.mapper.RouseMoneyFilterConfigMapper;
import com.lebangweb.common.TextUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * rouse_money_filter_config
 *
 * @Author xwj
 * @Date 2021-01-06
 */
@Service
public class RouseMoneyFilterConfigService extends BaseService<RouseMoneyFilterConfig, Long, RouseMoneyFilterConfigExample> {

    @Autowired
    private RouseMoneyFilterConfigMapper baseMapper;

    /**
     * 检查当前用户不显示进度条
     * @param all
     * @param appStore
     * @return
     */
    public boolean check(Integer all, String appStore) {
        RouseMoneyFilterConfig config = baseMapper.selectByAppStore(appStore);
        if(config==null){
            //配置不存在显示进度条
            return false;
        }
        if(TextUtil.isEmpty(all)){
            //用户金额不存在,不显示进度条
            return true;
        }
        //用户金额小于配置金额不显示进度条
        return all < config.getMoney();
    }
}
